<!doctype html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title><?php  echo $this->address; ?></title>
    <meta name="description" content="">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    <meta name="apple-mobile-web-app-title" content="Amaze UI" />


    <link rel="apple-touch-icon-precomposed" href="<?php echo base_url() . 'public/business/'; ?>assets/i/app-icon72x72@2x.png"><link rel="icon" type="image/png" href="<?php echo base_url() . 'public/business/'; ?>assets/i/favicon.png">
    <link rel="stylesheet" href="<?php echo base_url() . 'public/business/'; ?>assets/css/amazeui.min.css"/>
    <link rel="stylesheet" href="<?php echo base_url() . 'public/business/'; ?>assets/css/admin.css">


    <script src="<?php echo base_url() . 'public/business/'; ?>assets/js/jquery.min.js"></script>


    <script type="text/javascript" src="<?php echo base_url() . 'public/'; ?>/assets/js/jquery.pagination.js"></script>
    <script type="text/javascript" src="<?php echo base_url() . 'public/'; ?>/assets/js/base.js"></script>

    <script src="<?php echo base_url() . 'public/'; ?>assets/js/clipboard.min.js"></script>
  <!--  <script type="text/javascript" src="<?php /*echo base_url() . 'public/'; */?>/assets/js/jquery.date_input.js"></script>
    <link rel="stylesheet" href="<?php /*echo base_url() . 'public/'; */?>assets/css/date_input.css" type="text/css">-->

    <script type="text/javascript" src="<?php echo base_url() . 'public/'; ?>/assets/js/laydate.js"></script>
    <script src="<?php echo base_url() . 'public/'; ?>layer/layer.js"></script>

    <script type="text/javascript" src="<?php echo base_url() . 'public/'; ?>/assets/js/vue.js"></script>
    <!-- element -->
    <script src="https://unpkg.zhimg.com/element-ui/lib/index.js"></script>
    <link rel="stylesheet" href="https://unpkg.zhimg.com/element-ui/lib/theme-chalk/index.css">
    <link rel="stylesheet" href="<?php echo base_url() . 'public/'; ?>assets/css/page.css">

    <!--<script src="<?php /*echo base_url() . 'public/business/'; */?>assets/js/app.js"></script>-->
</head>

<!--[if lte IE 9]><p class="browsehappy">升级你的浏览器吧！ <a href="http://se.360.cn/" target="_blank">升级浏览器</a>以获得更好的体验！</p><![endif]-->

<style>
    #Pagination {
        text-align: center;
        margin-top: 14px;
    }

    .pagination span.prev,
    .pagination span.next {
        background-color: #fff;
        border: 1px solid #ddd;
    }

    .pagination a.next,
    .pagination a.prev,
    .pagination span.prev,
    .pagination span.next {
        color: #11cd95;
    }

    .pagination .current,
    .pagination a:hover {
        position: relative;
        border-color: #11cd95;
        color: #fff;
        background-color: #11cd95;
    }

    .pagination a,
    .pagination span {
        display: inline-block;
        margin-left: -1px;
        padding: 0 12px;
        border: 1px solid #ddd;
        line-height: 32px;
        font-size: 14px;
        color: #b9b9b9;
        background-color: #fff;
    }

    .pagination .total {
        display: inline-block;
        margin-right: 30px;
        background:#11cd95;
        color: #fff;
        border: 1px solid #ddd;
        padding: 4px 12px;
    }

</style>


<script>
    var baseurl='<?php echo base_url(); ?>';
    var user_id="<?php echo $this->user_id ?>";
    var toolCase={
        //url参数转对象
        getRequest: function (urlStr) {
            if (typeof urlStr == "undefined") {
                var url = decodeURI(location.search); //获取url中"?"符后的字符串
            } else {
                var url = "?" + urlStr.split("?")[1];
            }
            var theRequest = new Object();
            if (url.indexOf("?") != -1) {
                var str = url.substr(1);
                let strs = str.split("&");
                for (var i = 0; i < strs.length; i++) {
                    theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
                }
            }
            return theRequest;
        },
        getDateStr: function (AddDayCount,date) {
            if(date){
                var timestamp2 = Date.parse(new Date(date));
                var dd  = new Date(timestamp2);
            }else{
                var dd = new Date();
            }
            dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
            var y = dd.getFullYear();
            var m = dd.getMonth() + 1; //获取当前月份的日期
            var d = dd.getDate();
            if (d < 10) {
                d = '0' + d
            }
            return y + '-' + (m < 10 ? '0' + m : m) + '-' + d;
        },
        isInteger: function (number) {
            var numReg = /^[0-9]*$/;
            var numRe = new RegExp(numReg);
            if (!numRe.test(number)) {
                return false;
            }
            return true;
        },
        uniqueArr: function (arr) {
            var x = new Set(arr);
            return [...x];
        },
        downExcel: function (tabletitel, columns, list, funtionName) {

            var excelname = funtionName + "-" + tabletitel + " " + toolCase.getDate();
            var newcolumns = {};
            $.each(columns, function (i, v) {
                if (i == "url") {
                    return
                }
                newcolumns[i] = v;
            });

            var newlist = [];
            $.each(list, function (i, v) {

                var item = {};
                $.each(v, function (i2, v2) {
                    item[i2] = v2;
                })
                if (v.info) { //店铺信息取名字作为导出字段
                    item.info = v.info.name;
                }
                if (v.itemInfo) {//商品信息取名字作为导出字段
                    item.itemInfo = v.itemInfo.name;
                }
                if (v.brandinfo) {//商品信息取名字作为导出字段
                    item.brandinfo = v.itemInfo.brandinfo;
                }
                if (v.rank) {
                    if (v.rank.rankNum) {
                        item.rank = v.rank.rankNum;
                    }
                }

                newlist.push(item);
            });
            var ShowLabel = [newcolumns];
            toolCase.toExcel(excelname, ShowLabel, newlist)
        },
        toExcel: function (FileName, ShowLabel, JSONData) {
            //先转化json
            var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData;
            var excel = '<table>';
            //设置表头
            var row = "<tr align='left'>";//设置Excel的左居中
            for (var i = 0, l = ShowLabel.length; i < l; i++) {
                for (var key in ShowLabel[i]) {
                    row += "<td>" + ShowLabel[i][key] + '</td>';
                }
            }
            //换行
            excel += row + "</tr>";
            //设置数据
            for (var i = 0; i < arrData.length; i++) {
                var rowData = "<tr align='left'>";

                for (var y = 0; y < ShowLabel.length; y++) {
                    for (var k in ShowLabel[y]) {
                        if (ShowLabel[y].hasOwnProperty(k)) {
                            rowData += "<td style='vnd.ms-excel.numberformat:@'>" + (arrData[i][k] === null ? "" : arrData[i][k]) + "</td>";
                            //vnd.ms-excel.numberformat:@ 输出为文本
                        }
                    }
                }
                excel += rowData + "</tr>";
            }
            excel += "</table>";
            var excelFile = "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:excel' xmlns='http://www.w3.org/TR/REC-html40'>";
            excelFile += '<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8">';
            excelFile += '<meta http-equiv="content-type" content="application/vnd.ms-excel';
            excelFile += '; charset=UTF-8">';
            excelFile += "<head>";
            excelFile += "<!--[if gte mso 9]>";
            excelFile += "<xml>";
            excelFile += "<x:ExcelWorkbook>";
            excelFile += "<x:ExcelWorksheets>";
            excelFile += "<x:ExcelWorksheet>";
            excelFile += "<x:Name>";
            excelFile += "{worksheet}";
            excelFile += "</x:Name>";
            excelFile += "<x:WorksheetOptions>";
            excelFile += "<x:DisplayGridlines/>";
            excelFile += "</x:WorksheetOptions>";
            excelFile += "</x:ExcelWorksheet>";
            excelFile += "</x:ExcelWorksheets>";
            excelFile += "</x:ExcelWorkbook>";
            excelFile += "</xml>";
            excelFile += "<![endif]-->";
            excelFile += "</head>";
            excelFile += "<body>";
            excelFile += excel;
            excelFile += "</body>";
            excelFile += "</html>";
            var uri = 'data:application/vnd.ms-excel;charset=utf-8,' + encodeURIComponent(excelFile);
            var link = document.createElement("a");
            link.href = uri;
            link.style = "visibility:hidden";
            link.download = FileName + ".xls";
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
        },
        getDate: function () {
            var myDate = new Date;
            var year = myDate.getFullYear(); //获取当前年
            var mon = myDate.getMonth() + 1; //获取当前月
            var date = myDate.getDate(); //获取当前日

            return year + "年" + mon + "月" + date + "日"
        },

        /**
         * 统一表格排序
         * @param column
         * @param list
         * @returns {*}
         */
        changeTableSort:function(column, list, setlevel) {

            //获取字段名称和排序类型
            var fieldName = column.prop;
            var sortingType = column.order;

            function sortnum(a, b) {
                var aval = a[fieldName];
                var bval = b[fieldName];

                if (fieldName == 'date') {
                    aval = Date.parse(new Date(aval));
                    bval = Date.parse(new Date(bval));
                } else {
                    if (typeof (aval) == 'string') {
                        aval = (aval.replace("%", "")) * 1;
                        bval = (bval.replace("%", "")) * 1;
                    }
                }
                return (bval - aval);
            }

            function sortnum2(a, b) {
                var aval = a[fieldName];
                var bval = b[fieldName];
                if (fieldName == 'date') {
                    aval = Date.parse(new Date(aval));
                    bval = Date.parse(new Date(bval));
                } else {
                    if (typeof (aval) == 'string') {
                        aval = (aval.replace("%", "")) * 1;
                        bval = (bval.replace("%", "")) * 1;
                    }
                }
                return (aval - bval)
            }

            //按照降序排序
            if (sortingType == "descending") {
                list = list.sort(sortnum);
            }
            //按照升序排序
            else {
                list = list.sort(sortnum2);
            }
            if (setlevel) {//设置数据排序等级 以使用颜色深度进行展示
                let all = list[0][fieldName] * 1 - list[(list.length - 1)][fieldName] * 1
                if (list[0][fieldName] == list[(list.length - 1)][fieldName] * 1) {
                    $.each(list, function (i, v) {
                        v.level = 0;
                    })
                } else {
                    let avg = all / 10;
                    $.each(list, function (i, v) {
                        let value = v[fieldName];
                        v.level = parseInt(value / avg);
                    })
                }
            }
            return list
        },
    };

    /**
     * 封装的ajax
     * @param url
     * @param postdate
     * @returns {Promise<unknown>}
     */
    function  ajax(url,postdate) {
        return  new Promise(
            function (resolve, reject) {
                  $.ajax({
                    url:baseurl+url,
                    type:"post",
                    dataType:"json",
                    // Form数据
                    data: postdate,
                    success:function(data){
                      //  console.log(data)
                        resolve(data) // 数据处理完成
                    }
                });
            }
        )
    }
</script>

</head>



<body>
<header class="am-topbar admin-header">
    <div class="am-topbar-brand"><img src="<?php echo base_url() . 'public/business/'; ?>assets/i/logo.png"></div>

    <div class="am-collapse am-topbar-collapse" id="topbar-collapse">

        <ul class="am-nav am-nav-pills am-topbar-nav admin-header-list">

            <li class="am-dropdown tognzhi" data-am-dropdown>

                <button class="am-btn am-btn-primary am-dropdown-toggle am-btn-xs am-radius " data-am-dropdown-toggle> <?php echo $this->session->username; ?><span class="am-badge am-badge-danger am-round">0</span></button>
                <ul class="am-dropdown-content">



                    <li class="am-dropdown-header">操作</li>
                    <li><a href="<?php  echo base_url();?>welcome/loginout">退出登陆</a></li>


                    <!--    <li><a href="#">未激活会员 <span class="am-badge am-badge-danger am-round">556</span></a></li>
                        <li><a href="#">未激活代理 <span class="am-badge am-badge-danger am-round">69</span></a></a></li>
                        <li><a href="#">未处理汇款</a></li>
                        <li><a href="#">未发放提现</a></li>
                        <li><a href="#">未发货订单</a></li>
                        <li><a href="#">低库存产品</a></li>
                        <li><a href="#">信息反馈</a></li>-->



                </ul>
            </li>

            <li class="kuanjie">
                <a href="">拥有资金：<?php echo $this->session->userinfo["money"]; ?> </a>
                <a href="<?php  echo base_url();?>business/index">商户后台</a>
                <a href="<?php  echo base_url();?>hunter/index">测试员后台</a>
                <a href="<?php  echo base_url();?>customer/index">管理后台</a>



                <!--   <a href="#">产品管理</a>
                   <a href="#">个人中心</a>
                   <a href="#">系统设置</a>-->
            </li>

            <!--    <li class="soso">

                    <p>

                        <select data-am-selected="{btnWidth: 70, btnSize: 'sm', btnStyle: 'default'}">
                            <option value="b">全部</option>
                            <option value="o">产品</option>
                            <option value="o">会员</option>

                        </select>

                    </p>

                    <p class="ycfg"><input type="text" class="am-form-field am-input-sm" placeholder="圆角表单域" /></p>
                    <p><button class="am-btn am-btn-xs am-btn-default am-xiao"><i class="am-icon-search"></i></button></p>
                </li>
                <li class="am-hide-sm-only" style="float: right;"><a href="javascript:;" id="admin-fullscreen"><span class="am-icon-arrows-alt"></span> <span class="admin-fullText">开启全屏</span></a></li>-->


        </ul>
    </div>
</header>


